﻿<%@ Page Title="" Language="C#" MasterPageFile="~/administration/Admin.master" AutoEventWireup="true"
    CodeFile="ManageUsers.aspx.cs" Inherits="administration_ManageUsers" %>

<%@ MasterType VirtualPath="~/administration/Admin.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            if ($("#txtNumberOfPosts").val() != "") {
                var fromTos = $('.nop.hdn');
                fromTos.show();
            }
            if ($("#isTheSame").attr("checked") == "checked") {
                var fromTos = $('.sep.hdn');
                fromTos.show();
            }
            $("#txtNumberOfPosts").keyup(function () {
                var fromTos = $('.nop.hdn');
                if ($(this).val() != '') {
                    fromTos.show();
                } else {
                    fromTos.hide();
                }
            });
            $("#isTheSame").change(function () {
                var fromTos = $('.sep.hdn');
                if ($(this).attr("checked") == "checked") {
                    fromTos.show();
                } else {
                    fromTos.hide();
                }
            });
        });
    </script>
    <style type="text/css">
        .hdn
        {
            display: none;
        }
        #filtr td
        {
            height: 40px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="filtr" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <label for="txtUserName">
                    User Name
                </label>
            </td>
            <td>
                <div class="element">
                    <input id="txtUserName" runat="server" clientidmode="Static" name="name" class="text err" />
                </div>
            </td>
        </tr>
        <tr>
            <td width="43px">
                <label for="txtNumberOfPosts">
                    Number of posts
                </label>
            </td>
            <td width="153px">
                <input id="txtNumberOfPosts" runat="server" clientidmode="Static" name="name" class="text err" />
            </td>
            <td>
                <label for="txtPostsDateFrom" class="nop hdn">
                    Choose date from
                </label>
            </td>
            <td>
                <input id="txtPostsDateFrom" runat="server" clientidmode="Static" name="name" class="text err nop hdn" />
            </td>
            <td>
                <label for="txtPostsDateTo" class="nop hdn">
                    to
                </label>
            </td>
            <td>
                <input id="txtPostsDateTo" runat="server" clientidmode="Static" name="name" class="text err nop hdn" />
            </td>
        </tr>
        <tr>
            <td width="43px">
                <label for="isTheSame">
                    Search equal posts?
                </label>
            </td>
            <td width="153px">
                <input id="isTheSame" type="checkbox" runat="server" clientidmode="Static" name="name"
                    class="text err" />
            </td>
            <td>
                <label for="txtEqualsFrom" class="sep hdn">
                    Choose date from
                </label>
            </td>
            <td>
                <input id="txtEqualsFrom" runat="server" clientidmode="Static" name="name" class="text err sep hdn" />
            </td>
            <td>
                <label for="txtEqualsTo" class="sep hdn">
                    to
                </label>
            </td>
            <td>
                <input id="txtEqualsTo" runat="server" clientidmode="Static" name="name" class="text err sep hdn" />
            </td>
        </tr>
    </table>
    <div class="entry">
        <button type="submit" id="Preview" runat="server" onserverclick="Preview_Click">
            Preview</button>
    </div>
    <asp:Label ID="lblUserNotFound" Text="Users not found" runat="server" ForeColor="Red"
        Visible="false" />
    <asp:GridView ID="gvUsers" runat="server" AutoGenerateColumns="false" Visible="false"
        DataKeyNames="ID" OnRowDeleting="gvUsers_RowDeleting" OnRowEditing="gvUsers_RowEditing"
        OnRowCommand="gvUsers_RowCommand" Width="700">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" ControlStyle-Width="20px" />
            <asp:TemplateField HeaderText="Avatar" ControlStyle-Width="51px">
                <ItemTemplate>
                    <asp:Image ID="AvatarImage" ImageUrl='<%# Eval("Avatar") %>' runat="server" Width="50px"
                        Height="50px" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="FirstName" HeaderText="Fist Name" ControlStyle-Width="120px" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" ControlStyle-Width="120px" />
            <asp:BoundField DataField="Reviews" HeaderText="Reviews" ControlStyle-Width="20px" />
            <asp:TemplateField HeaderText="Review" ControlStyle-Width="60px">
                <ItemTemplate>
                    <asp:Label ID="lblRevText" Text='<%#Eval("Review")%>' runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField HeaderText="Dlt" ShowDeleteButton="true" CancelText="Cancel" DeleteText="Delete"
                ButtonType="Image" DeleteImageUrl="~/administration/img/ad-delete.png" />
            <asp:CommandField HeaderText="Ban" ShowEditButton="true" CancelText="Cancel" UpdateText="Update"
                ButtonType="Image" EditImageUrl="~/administration/img/ad-block.png" />
            <asp:ButtonField ButtonType="Image" CommandName="DeleteSimilar" Visible="false" ImageUrl="~/administration/img/ad-block.png"
             HeaderText="DltRow" Text="Double" />
        </Columns>
    </asp:GridView>
</asp:Content>
